package com.ryskoo.basicdata.organization.domain;

import com.ryskoo.framework.core.bean.BasicPO;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.ArrayList;
import java.util.List;

@Entity
@Table(name = "BDS_ORGANIZATION")
public class OrganizationPO extends BasicPO {

	private static final long serialVersionUID = 1L;

	/* 机构名称 */
	@Column(name = "org_name", length = 10)
	private String name;

	/* 上级机构 */
	@Column(name = "parent_id", columnDefinition = "char", length = 32)
	private String parentId;

	/* 机构描述 */
	@Column(name = "description", length = 200)
	private String description;
	
	/* 子机构集合 */
	@Transient
	private List<OrganizationPO> childrens = new ArrayList<OrganizationPO>();


	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getParentId() {
		return parentId;
	}

	public void setParentId(String parentId) {
		this.parentId = parentId;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public List<OrganizationPO> getChildrens() {
		return childrens;
	}

	public void setChildrens(List<OrganizationPO> childrens) {
		this.childrens = childrens;
	}

	@Override
	public String toString() {
		return "OrganizationPO [orgName=" + name + ", parentId=" + parentId
				+ ", description=" + description + "]";
	}
}
